home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16096 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu
  4. Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada)
  5. Date: 9 Apr 1996 10:11:29 -0500
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4kdun1$2kk@solutions.solon.com>
  8. References: <JSA.96Feb16135027@organon.com> <dewar.828987544@schonberg> <4kcein$mev@solutions.solon.com> <dewar.829054330@schonberg>
  9. Reply-To: seebs@solon.com
  10. NNTP-Posting-Host: solutions.solon.com
  11.  
  12. In article <dewar.829054330@schonberg>, Robert Dewar <dewar@cs.nyu.edu> wrote:
  13. >OK, "it" here is any specification of how long the buffer should be. So
  14. >Peter considers it undefined, in which case *any* call to read is
  15. >undefined. Actually I completely agree, if the spec of a routine is
  16. >incomplete or imprecise, the routine cannot be called without generating
  17. >undefined behavior.
  18.  
  19. Well, read() can't be called in C.  Assuming POSIX, the behavior is clearly
  20. defined, but no specification is made of which if any boundaries are checked;
  21. thus, the only safe thing to do is comply with all of them reliably.
  22.  
  23. >But in the absence of Kazimir to tell us the "unwritten" rules, isn't it
  24. >just possible that this *might* lead to portability problems :-) Of course
  25. >by Peter's rules, we can't call read at all :-)
  26.  
  27. Not in C.  My rule would be that if a function does not say something is safe,
  28. you shouldn't do it.  The normal descriptions of read() (I've read dozens, and
  29. they're all pretty much equivalent) describe the behavior in terms of a buffer
  30. having enough space to hold nbytes of data.
  31.  
  32. >Peter do you have SPEC1170, I assume you must have a copy, so can you
  33. >see there if the spec is any more illuminating?
  34.  
  35. No, I don't have a copy.  Spec 1170 is nearly as expensive as ANSI, and I get
  36. expensive specs only once or twice a year.
  37.  
  38.  
  39.  
  40. -s
  41. -- 
  42. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  43. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  44. FUCK the communications decency act.  Goddamned government.  [literally.]
  45. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  46.